package com.ddd.mill.domain.aggregate.constant.product.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum AttributeTypeEnum {
    /**
     *
     */
    IMAGE(1, "原纸"),
    VIDEO(2, "辅料");

    @EnumValue
    private final Integer value;
    private final String desc;

    AttributeTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @JsonCreator
    public static AttributeTypeEnum get(Integer value){
        for (AttributeTypeEnum e : AttributeTypeEnum.values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
